From 1ae05ee739d47a221a53ba52e2cc9f7b3cb28768 Mon Sep 17 00:00:00 2001 From: "akw27@labyrinth.cl.cam.ac.uk" Date: Sat, 1 Nov 2003 16:39:16 +0000 Subject: [PATCH] bitkeeper revision 1.546.1.1 (3fa3e1b4UwJQtnD-lZcvMsbqR-XhSA) sched hypercall unification -- tidying things up in anticipation of suspend/resume --- xen/arch/i386/entry.S | 3 +- xen/common/schedule.c | 59 ++++++++++++++----- xen/include/hypervisor-ifs/hypervisor-if.h | 33 +++++++---- .../include/asm-xeno/hypervisor.h | 6 +- 4 files changed, 69 insertions(+), 32 deletions(-) diff --git a/xen/arch/i386/entry.S b/xen/arch/i386/entry.S index 953a2fe03d..1c828bc1ab 100644 --- a/xen/arch/i386/entry.S +++ b/xen/arch/i386/entry.S @@ -713,8 +713,7 @@ ENTRY(hypervisor_call_table) .long SYMBOL_NAME(do_set_callbacks) .long SYMBOL_NAME(do_net_io_op) .long SYMBOL_NAME(do_fpu_taskswitch) - .long SYMBOL_NAME(do_yield) - .long SYMBOL_NAME(kill_domain) + .long SYMBOL_NAME(do_sched_op) .long SYMBOL_NAME(do_dom0_op) .long SYMBOL_NAME(do_network_op) .long SYMBOL_NAME(do_block_io_op) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 9cd98b65a5..53d7b576b6 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -111,9 +111,9 @@ static void __calc_evt(struct task_struct *p) } -/****************************************************************************** -* Add and remove a domain -******************************************************************************/ +/* + * Add and remove a domain + */ void sched_add_domain(struct task_struct *p) { p->state = TASK_SUSPENDED; @@ -157,9 +157,9 @@ void init_idle_task(void) } -/**************************************************************************** +/* * wake up a domain which had been sleeping - ****************************************************************************/ + */ int wake_up(struct task_struct *p) { unsigned long flags; @@ -194,9 +194,9 @@ int wake_up(struct task_struct *p) return ret; } -/**************************************************************************** +/* * Voluntarily yield the processor to another domain, until an event occurs. - ****************************************************************************/ + */ long do_yield(void) { current->state = TASK_INTERRUPTIBLE; @@ -205,18 +205,47 @@ long do_yield(void) return 0; } -/**************************************************************************** +/* + * Demultiplex scheduler-related hypercalls. + */ +long do_sched_op(unsigned long op) +{ + long ret = 0; + + switch( op ) + { + + case SCHEDOP_yield: + { + ret = do_yield(); + break; + } + + case SCHEDOP_exit: + { + kill_domain(); + break; + } + + default: + ret = -ENOSYS; + } + + return ret; +} + +/* * Control the scheduler - ****************************************************************************/ + */ long sched_bvtctl(unsigned long c_allow) { ctx_allow = c_allow; return 0; } -/**************************************************************************** +/* * Adjust scheduling parameter for a given domain - ****************************************************************************/ + */ long sched_adjdom(int dom, unsigned long mcu_adv, unsigned long warp, unsigned long warpl, unsigned long warpu) { @@ -239,14 +268,14 @@ long sched_adjdom(int dom, unsigned long mcu_adv, unsigned long warp, return 0; } -/**************************************************************************** +/* * cause a run through the scheduler when appropriate * Appropriate is: * - current task is idle task * - the current task already ran for it's context switch allowance * Otherwise we do a run through the scheduler after the current tasks * context switch allowance is over. - ****************************************************************************/ + */ void reschedule(struct task_struct *p) { int cpu = p->processor; @@ -286,13 +315,13 @@ void reschedule(struct task_struct *p) } -/**************************************************************************** +/* * The main function * - deschedule the current domain. * - pick a new domain. * i.e., the domain with lowest EVT. * The runqueue should be ordered by EVT so that is easy. - ****************************************************************************/ + */ asmlinkage void __enter_scheduler(void) { struct task_struct *prev, *next, *next_prime, *p; diff --git a/xen/include/hypervisor-ifs/hypervisor-if.h b/xen/include/hypervisor-ifs/hypervisor-if.h index 33115a7941..683efc007f 100644 --- a/xen/include/hypervisor-ifs/hypervisor-if.h +++ b/xen/include/hypervisor-ifs/hypervisor-if.h @@ -48,19 +48,18 @@ #define __HYPERVISOR_set_callbacks 5 #define __HYPERVISOR_net_io_op 6 #define __HYPERVISOR_fpu_taskswitch 7 -#define __HYPERVISOR_yield 8 -#define __HYPERVISOR_exit 9 -#define __HYPERVISOR_dom0_op 10 -#define __HYPERVISOR_network_op 11 -#define __HYPERVISOR_block_io_op 12 -#define __HYPERVISOR_set_debugreg 13 -#define __HYPERVISOR_get_debugreg 14 -#define __HYPERVISOR_update_descriptor 15 -#define __HYPERVISOR_set_fast_trap 16 -#define __HYPERVISOR_dom_mem_op 17 -#define __HYPERVISOR_multicall 18 -#define __HYPERVISOR_kbd_op 19 -#define __HYPERVISOR_update_va_mapping 20 +#define __HYPERVISOR_sched_op 8 +#define __HYPERVISOR_dom0_op 9 +#define __HYPERVISOR_network_op 10 +#define __HYPERVISOR_block_io_op 11 +#define __HYPERVISOR_set_debugreg 12 +#define __HYPERVISOR_get_debugreg 13 +#define __HYPERVISOR_update_descriptor 14 +#define __HYPERVISOR_set_fast_trap 15 +#define __HYPERVISOR_dom_mem_op 16 +#define __HYPERVISOR_multicall 17 +#define __HYPERVISOR_kbd_op 18 +#define __HYPERVISOR_update_va_mapping 19 /* And the trap vector is... */ #define TRAP_INSTR "int $0x82" @@ -152,6 +151,14 @@ #define EVENTS_MASTER_ENABLE_BIT 31 +/* + * SCHEDOP_* - Scheduler hypercall operations. + */ +#define SCHEDOP_yield 0 +#define SCHEDOP_exit 1 + + + #ifndef __ASSEMBLY__ #include "network.h" diff --git a/xenolinux-2.4.22-sparse/include/asm-xeno/hypervisor.h b/xenolinux-2.4.22-sparse/include/asm-xeno/hypervisor.h index 285319ab6a..9450f76f3c 100644 --- a/xenolinux-2.4.22-sparse/include/asm-xeno/hypervisor.h +++ b/xenolinux-2.4.22-sparse/include/asm-xeno/hypervisor.h @@ -245,7 +245,8 @@ static inline int HYPERVISOR_yield(void) int ret; __asm__ __volatile__ ( TRAP_INSTR - : "=a" (ret) : "0" (__HYPERVISOR_yield) ); + : "=a" (ret) : "0" (__HYPERVISOR_sched_op), + "b" (SCHEDOP_yield) ); return ret; } @@ -255,7 +256,8 @@ static inline int HYPERVISOR_exit(void) int ret; __asm__ __volatile__ ( TRAP_INSTR - : "=a" (ret) : "0" (__HYPERVISOR_exit) ); + : "=a" (ret) : "0" (__HYPERVISOR_sched_op), + "b" (SCHEDOP_exit) ); return ret; } -- 2.30.2